<?php
/**
 * Feed model
 *
 * PHP version 5
 *
 * @category   Web
 * @package    Data2People
 * @subpackage Models
 * @author     Mike Bevz <mike.bevz@data2people>
 * @copyright  2007-2008 (c) Mike Bevz
 * @license    The BSD License http://data2people.com/license.txt
 * @version    SVN: $Id: Phrase.php 13 2008-12-01 16:16:50Z michael.bevz $
 *
 */

require_once 'BaseClasses/BasePhrase.php';
require_once 'TV/Model/Exception.php';
require_once 'Doctrine/Query.php';

class Feed extends BaseFeed
{
    /**
     * Return Feed by link
     *
     * @param string $link
     *
     * @return Doctrine_Collection
     * @throws TV_Model_Exception If link is not a string
     */
    public function getByLink($link)
    {
        if (!is_string($link)) {
            throw new TV_Model_Exception(__METHOD__ .
                      ': the method requires string as argument, got ' .
                      gettype($link));
        }
        $link = Doctrine_Query::create()->from('Feed')
                                        ->addWhere('link =?', array($link))
                                        ->execute();
        return $link;
    }
}